package org.agile2soft.nexoma.tapestry.components.grid;

import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.annotations.Parameter;

public class ColumnFormatter {

    @Parameter(required=true,defaultPrefix=BindingConstants.PROP)
    private String value;

    @Parameter
    private int maxLength=-1;

    public String getValue() {
        if ( value==null ) value = "";
        return (maxLength==-1 || value.length() < maxLength) ?
               value : value.substring(0,maxLength-3) + "...";
    }

}

